package com.test.packag;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

//Since this is an object collection, use a FragmentStatePagerAdapter,
//and NOT a FragmentPagerAdapter.
public class DemoCollectionPagerAdapter extends
     FragmentStatePagerAdapter {
 public DemoCollectionPagerAdapter(FragmentManager fm) {
     super(fm);
 }

 @Override
 public Fragment getItem(int i) {
     Fragment fragment = new DemoObjectFragment();
     Bundle args = new Bundle();
     // Our object is just an integer :-P
     args.putInt(DemoObjectFragment.ARG_OBJECT, i + 1);
     fragment.setArguments(args);
     return fragment;
 }

 @Override
 public int getCount() {
     return 100;
 }

 @Override
 public CharSequence getPageTitle(int position) {
     return "OBJECT " + (position + 1);
 }
}
